<?php
if ( !defined('IN_ADMINCP') || !defined('IN_SEC') ){
	exit('Access Denied.');
}
$tasks = limitquery('team_task', $where, $options = array('order' => 'ORDER BY `id` DESC'));

$ids = idserializes($tasks, 'id, teamid');
$teams = parse_array(limitquery('team', "`id` IN('{$ids['teamid']}')"));

foreach( $tasks as $k => $v ){
	$teams[$v['teamid']]['tasks'][$v['id']] = $v;
}

$companys = get_parse_companys($admincp->admins);

//$departments = parse_array(limitquery('admincp_department'));

function filter_by_type($name = '全部', $by = 'all'){
	global $searchby;

	$query_string = array();
	$uri = $_SERVER['REQUEST_URI'];
	$query = strpos($uri, '?');
	if ( $query ){
		$uri = substr($uri, $query + 1);
		parse_str($uri, $query_string);
	}
	if ( $query_string['page'] ){
		unset($query_string['page']);
	}
	$query_string['searchby'] = $by;

	$href = '?' . http_build_query($query_string);
	$class = $searchby == $by ? 'inverse' : 'primary';
	$name = $searchby == $by ? '<i class="icon-check"></i><strong>' . $name . '</strong>' : $name;
	return '<a class="btn btn-xs btn-'.$class.'" href="'.$href.'">'.$name.'</a>
';
}
?>